package com.miyu.client1.service.impl;

import com.miyu.client1.dao.userDao;
import com.miyu.client1.pojo.UserTableEntity;
import com.miyu.client1.service.userService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;

@Service
public class userServiceImpl implements userService {
    @Resource
    private userDao ud;

    @Override
    public String save(UserTableEntity userTableEntity) {
        userTableEntity.setId(this.UUID());
        userTableEntity.setUserAccount("张三");
        userTableEntity.setUserName("cehsi");
        userTableEntity.setUserSex("1");
        userTableEntity.setUserEmail("123@qq.com");
        userTableEntity.setUserPassword("123456");
        ud.save(userTableEntity);
        return "保存成功";
    }
    private  String UUID(){
        String uuid = UUID.randomUUID().toString().replaceAll("-","");
        return uuid;
    }
    @Override
    public List<UserTableEntity> queryData(String name){
        return  ud.queryUser(name);
    }

    @Override
    public List<Object> queryDataBySql() {
        return ud.queryDataBySql();
    }
}
